package controller;
import model.*;
public class CustomerController {

        private CustomerContainer customerCont;
        
        public CustomerController()
        {
            customerCont = CustomerContainer.getInstance();
        }
        
        public Person findCustomer(String address)
        {
            return customerCont.findPerson(address);
        }
        public boolean createCustomer(String name, String address,String number,String cpr,String email,String phone)
        {
            Person customerObj = new Customer(name, phone, cpr, email, address);
            if(customerObj != null)
            {
                customerCont.addPerson(customerObj);
                return true;
            }
            else 
            {
                return false;
            }
            
        }
        
        public boolean updateCustomer(String oldName, Customer newCustomer){
            boolean success = false;
            success = customerCont.updatePerson(oldName, newCustomer);
            return success;
        }
        public boolean removeCustomer(String address) {
            if(findCustomer(address)!=null) 
            {
                customerCont.removePerson(address);
                return true;
            }
            else 
            {
                return false;
            }
        }
        
    }